﻿#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QWidget>
#include <QLineEdit>
#include <QLabel>

#include "Input/input.h"
#include "Total/total.h"
#include "Login/login.h"
#include "iov_flower.h"
#include "flower.h"
#include "user_db.h"
#include "account_db.h"

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
    void Init_All();

private slots:
    void on_pushButton_clicked();
    void Delate_Win(QString m_Win);
    void Message_Show(QString Message);

    void on_pushButton_2_clicked();
    void Time_Handle();
    void on_pushButton_3_clicked();

    void on_pushButton_4_clicked();

    void on_pushButton_5_clicked();

    void logged(QString user_name, account_db *account_data_db);

    void create_group();//新建账簿槽函数
    void cancel_group();
    void on_pushButton_6_clicked();

    void on_pushButton_7_clicked();

private:
    Ui::MainWindow *ui;
    Input *m_input;
    Total *m_total;
    login *w_login;
    flower *m_flower;
    Iov_flower *m_iov_flower;
    QString log_user;



    account_db *logged_account_db;   //保存当前打开的数据库名字

    void Copy_File();
    void butten_state(char sta);
    void show_group_widget(QString select);



    //新建账簿的窗口的组建，需要全局处理
    void update_groups();

    QWidget* w ;
    QLineEdit * creat_acc_edit;
    QPushButton * bt_yes;
    enum{
        log_out_account = 0,
        logged_in_account,
        log_out_flower,
        logged_in_flower
    }login_sta;
signals:
    void creat_table(QString table_name);
    void update_group_data(QStringList g_list);
};
#endif // MAINWINDOW_H
